package cn.bugstack.domain.activity.service.trial;

import cn.bugstack.domain.activity.adapter.repository.IActivityRepository;
import cn.bugstack.domain.activity.service.trial.factory.DefaultActivityStrategyFactory;
import cn.bugstack.wrench.design.framework.tree.AbstractMultiThreadStrategyRouter;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

/**
 * @description 功能服务支撑类：抽象的拼团营销支撑类，     继承策略路由抽象类，由根节点，开关节点，各种节点继承
 */
// 继承多线程策略路由，                                 入参，产品实体          动态上下文       出参，试算实体
public abstract class AbstractGroupBuyMarketSupport<MarketProductEntity, DynamicContext, TrialBalanceEntity>
        // 多线程策略路由类
        extends AbstractMultiThreadStrategyRouter<cn.bugstack.domain.activity.model.entity.MarketProductEntity,
        //  参数
        DefaultActivityStrategyFactory.DynamicContext, cn.bugstack.domain.activity.model.entity.TrialBalanceEntity> {

    // 超时时间
    protected long timeout = 5000;

    @Resource
    protected IActivityRepository repository;

    // 多线程处理，异步加载数据
    @Override
    protected void multiThread(cn.bugstack.domain.activity.model.entity.MarketProductEntity requestParameter,
            DefaultActivityStrategyFactory.DynamicContext dynamicContext)
            throws ExecutionException, InterruptedException, TimeoutException {
        // 缺省的方法，谁需要加载数据，谁去重写
    }

}
